from PIL import Image, ImageDraw, ImageFont

def print_chinese_name(name, font_size=24, font_path=None):
    """打印多个中文字符（名字）"""
    # 设置字体路径（自动适配系统）
    if not font_path:
        import platform
        system = platform.system()
        if system == "Windows":
            font_path = "C:/Windows/Fonts/simhei.ttf"  # 黑体
        elif system == "Darwin":  # macOS
            font_path = "/System/Library/Fonts/PingFang.ttc"  # 苹方
        else:  # Linux
            font_path = "/usr/share/fonts/opentype/noto/NotoSansCJK-Regular.ttc"

    # 为每个字创建图像并提取像素
    chars_pixels = []
    for char in name:
        img = Image.new('1', (font_size, font_size), 1)
        draw = ImageDraw.Draw(img)
        try:
            font = ImageFont.truetype(font_path, font_size)
        except:
            font = ImageFont.load_default()
            print("警告：字体加载失败，可能显示异常")
        
        draw.text((0, 0), char, font=font, fill=0)
        # 提取当前字的所有行像素
        char_lines = []
        for y in range(font_size):
            line = ""
            for x in range(font_size):
                line += "*" if img.getpixel((x, y)) == 0 else " "
            char_lines.append(line)
        chars_pixels.append(char_lines)
    
    # 逐行拼接三个字并打印
    for y in range(font_size):
        line = ""
        for char in chars_pixels:
            line += char[y] + "  "  # 字之间加两个空格分隔
        print(line)

if __name__ == "__main__":
    # 打印“吴彩娜”
    print_chinese_name("吴彩娜", font_size=28)